<template>
  <ul class="cartlist">
    <li class="shop" v-for="(item) of cartlist" :key="item.id">
      <div class="left">
        <input type="checkbox" class="l" v-model="item.flag" @change="selectItem(item.flag)">
      </div>
      <div class="card">
        <div class="card-l">
          <img :src="item.images.small" alt=""  @click="goDetail(item.id)" >
        </div>
        <div class="card-r">
          <div class="card-r-t">
            <h4>{{ item.title }}</h4>
          </div>
          <div class="card-r-c">
            <p>
              {{ item.collect_count | moneyFilter}}
              <button @click="deleteItem(index, item.id)">删除</button>
            </p>
          </div>
          <div class="card-r-b">
            <u>{{ Math.round((item.collect_count) * 0.88) | moneyFilter}}</u>
            <div class="price">
              <button @click="item.num = 1 ? item.num = 1 : item.num = item.num - 1">-</button>
              <s>{{ item.num }}</s>
              <button @click="item.num = item.num + 1">+</button>
            </div>
          </div>
        </div>
      </div>
    </li>
  </ul>
</template>

<script>
// import Rating from './Rating'
export default {
  // props: ['prolist']
  props: {
    cartlist: Array
  },
  components: {
    // Rating
  },
  methods: {
    goDetail (id) {
      this.$router.push({ path: '/detail/' + id })
    }
  }
}
</script>

<style lang="scss">
@import '@/lib/reset.scss';
.cartlist {
  overflow: auto;
  .shop{
    display: flex;
    flex: 1;
    .left{
      width: 21px;
      height: 21px;
      input{
        width: 21px;
        height: 21px;
        border-radius: 50%;
        margin-top: 58px;
        margin-left: 8px;
      }
    }
    .card{
      margin-top: 15px;
      margin-left: 18px;
      display: flex;
      flex: 1;
      .card-l{
        img{
          width: 97px;
          height: 107px;
        }
      }
      .card-r{
        margin-left: 18px;
        .card-r-t{
          display: flex;
          justify-content: space-between;
          h4{
            font-size: 16px;
            font-weight: 100;
          }
        }
        .card-r-c{
          p{
            color:#aaa;
            text-decoration: line-through;
          }
        }
        .card-r-b{
          display: flex;
          justify-content: space-between;
          margin-top: 20px;
          u {
            color: red;
            margin-top: 0.1rem;
          }
          .price{
            width: 82px;
            height: 20px;
            border: 1px solid #efefef;
            button{
              width: 19px;
              height: 20px;
              background: #efefef;
              border: 0;
            }
            s{
              display: inline-block;
              width: 42px;
              height: 20px;
              text-align: center;
            }
          }
        }
      }
    }
  }
}  
</style>
